package cn.zyx.common.properites;

import cn.zyx.common.utils.sys.SpringContextHolderUtils;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.io.Serializable;

/**
 * 全局配置类
 */
@Data
@Configuration
public class GlobalProperties implements Serializable {

    private static final long serialVersionUID = 1L;

    // 实例化方式 - 从spring容器中获取
    public static GlobalProperties newInstance() {
        return SpringContextHolderUtils.getBean(GlobalProperties.class);
    }

    // jwt的刷新时间
    @Value("${jwt.accessToken.expireTime}")
    public long EXPIRE_TIME;


    /**
     * 上传文件基础虚拟路径
     */
    public static final String USERFILES_BASE_URL = "/userfiles/";

    /**
     * 是/否
     */
    public static final String YES = "1";
    public static final String NO = "0";

    /**
     * 对/错
     */
    public static final String TRUE = "true";
    public static final String FALSE = "false";


    /**
     * 显示/隐藏
     */
    public static final String SHOW = "1";
    public static final String HIDE = "0";

    public static final String _online_user_  = "_online_user_";
    public static final String _leave_user_  = "_leave_user_";
    public static final String _msg_ = "_msg_";
    public static final String WEBSOCKET_LOGINNAME = "websocket_loginname";


}
